<?php
if(get_theme_option('featured_posts') != '') {
?>
<script type="text/javascript">
Cobo.use('core').Do(function(S){
	// Carousel with pagination
	$("#hp_slide").slides({
    preload: true,
    preloadImage: '<?php bloginfo('template_directory'); ?>/images/loading.gif',
    play: 5000,
    pause: 2500,
	effect: 'fade',
    hoverPause: true
  });
},{requires:['jquery','slide']});
</script>
<div class="fullbox_excerpt">
	<div class="fullbox_content">
		<div class="smooth_gallery clearfix">
			<div id="hp_slide">
				<?php
				$featured_posts_category = get_theme_option('featured_posts_category');
				global $post;
				$featured_posts = get_posts("numberposts=5&&category=$featured_posts_category");
				$i = 0;

				?>
				
				<?php if($featured_posts_category != '' && $featured_posts_category != '0') {
					 foreach($featured_posts as $post) {
					 	setup_postdata($post);
                        if ( version_compare( $wp_version, '2.9', '>=' ) ) {
                            $slide_image_full = get_the_post_thumbnail($post->ID,'large', array('class' => 'full'));
                            $slide_image_thumbnail = get_the_post_thumbnail($post->ID,'large', array('class' => 'thumbnail'));
                        } else {
                            $get_slide_image = get_post_meta($post->ID, 'featured', true);
                            $slide_image_full = "<img src=\"$get_slide_image\" class=\"full\" alt=\"\" />";
                            $slide_image_thumbnail = "<img src=\"$get_slide_image\" class=\"thumbnail\" alt=\"\" />";
                        }
					 	
					  ?>
					  <div class="tab-pannel">
							<h3><?php the_title(); ?></h3>
							<?php the_excerpt(); ?>
							<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="open"></a> 
							<?php echo  $slide_image_full; ?>
							<?php echo  $slide_image_thumbnail; ?>
						</div>
					 <?php }
				} else {
					?>

					<div class="slides_container">
					<?php for($i = 1; $i <=5; $i++) {
						?>
							<div class="tab-pannel" style="display:none">
								<h3><a href="" title="">This is featured post <?php echo $i; ?> title</a></h3>
								<a href="#" title="This is featured post <?php echo $i; ?>" class="open"></a> 
								<img src="<?php bloginfo('template_directory'); ?>/jdgallery/slides/<?php echo $i; ?>.jpg" class="thumbnail" alt="" /> 
							</div>
						<?php
					}
				}
				
				?>
				</div>
			</div>
			<div class="mostpost">
				<ul>
					<li><a title="外媒透露新款iMac已出厂" href="http://wpmao.com/?p=33">外媒透露新款iMac已出厂</a></li>
					<li><a title="Android力战苹果iOS 成最受欢迎操作系统" href="http://wpmao.com/?p=18">Android力战苹果iOS 成最受欢迎操作系统</a></li>
					<li><a title="[多图]国内首款Android 2.3平板上市" href="http://wpmao.com/?p=16">[多图]国内首款Android 2.3平板上市</a></li>
					<li><a title="2011年平板电脑DRAM平均容量将增加147％" href="http://wpmao.com/?p=9">2011年平板电脑DRAM平均容量将增加147％</a></li>
					<li><a title="Rage to be prefaced by tie-in novel" href="http://wpmao.com/?p=5">Rage to be prefaced by tie-in novel</a></li>
				</ul>
			</div>
		</div>
	</div>
	<div class="ads"><?php echo $wplang[somewords] ?></div>
</div>
<?php } ?>